#-*- codeing = utf-8 -*-
#@Time : 2020/7/13 21:55
#@Author : 阳某
#@File : 函数.py
#@Software : PyCharm


def addnum(a,b):
    c = a+b
    print(c)
addnum(2,6)
def addnum(a,b):
    return a+b
addnum(1,2)
print(addnum(1,2))
# 返回多个值的函数
def divid(a,b):
    shang = a//b
    yushu = a%b
    return shang,yushu
sh,yu = divid(5,2)  #需要使用多个值来存返回内容
print(sh)
print(yu)
def oneline():
    print("-"*30)
def printNumLine(num):
    i = 0
    while i<num:
        oneline()
        i+=1
printNumLine(3)

#秋三个数的和
def sum3Number(a,b,c):
    return a+b+c
print(sum3Number(10,2,20))

# 球3个数的平均值
def average3Number(a,b,c):
    sumResult = sum3Number(10,20,30)
    aveResult = sumResult/3.0
    return aveResult
result = average3Number(10,20,30)
print(result)
'''
a = 100
def test1():
    a = 300
    print(a)
    a = 200
    print(a)
def test2():
    print(a)
test1()
test2()
'''
a = 100
def test1():
    global a #变成全局变量
    print(a)
    a = 200
    print(a)
def test2():
    print(a)
test1()
test2()














